"use strict";
cc._RF.push(module, '31256diav9DHKzcj+XL8cv7', 'boxLayout');
// Script/boxLayout.js

"use strict";

var _XmlHttpTool = require("./XmlHttpTool");

var _XmlHttpTool2 = _interopRequireDefault(_XmlHttpTool);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var boxItem = cc.Class({
    name: 'boxItem',
    properties: {
        iconString: cc.String
    }
});

cc.Class({
    extends: cc.Component,

    properties: {
        items: {
            default: [],
            type: boxItem
        },
        itemPrefab: cc.Prefab
    },

    // onLoad () {},

    start: function start() {},
    init: function init() {

        if (this.items.length > 0) {
            this.node.removeAllChildren();
        }

        var that = this;
        _XmlHttpTool2.default.NhttpPost("/marmot/game_box", {}, function (res) {

            console.log("游戏盒子动态", res);
            that.items = res;
            for (var i = 0; i < that.items.length; ++i) {

                var item = cc.instantiate(that.itemPrefab);
                that.node.addChild(item);
                item.getComponent('boxPrefab').init(that.items[i]);
            }
        });
    }
}

// update (dt) {},
);

cc._RF.pop();